from django.contrib.auth.models import User
from django.db import models


# Create your models here.
class Project(models.Model):
    objects: models.QuerySet

    name = models.CharField("项目名称", max_length=32)
    intro = models.CharField("项目简介", max_length=256, default="")
    url = models.CharField("项目地址", max_length=512, default="")

    member_list = models.ManyToManyField(User, blank=True, related_name="members")
    pm = models.ForeignKey(
        User, on_delete=models.SET_DEFAULT, default=1, related_name="pm"
    )


class Config(models.Model):
    objects: models.QuerySet

    conf = models.TextField("项目配置文件")
    project = models.OneToOneField(Project, on_delete=models.CASCADE)
